import React from 'react'
import qs from 'querystringify'
import { withRouter } from 'react-router-dom'
import { Row, Col } from 'antd'
import Breadcrumb from '@components/Breadcrumb/index'
import './index.less'
import SourceData from '@utils/sourceData.js'
const { leadingScientists } = SourceData
class Index extends React.Component {
    constructor(props) {
        super(props)
    }
    render() {
        document.title = '关于我们-领衔科学家-详情'

        let id = ''
        if (!!this.props.location.search) {
            id = qs.parse(this.props.location.search.slice(1)).id
        }else {
            return
        }
        let data = leadingScientists.filter((item, index) => item.id == id)
        if (!!data && data.length >0) {
            data = data[0]
        } else {
            return
        }
        console.log(data.AijingwenImg)
        return (<div id="leading-scientists-detail">
            <Breadcrumb arr={['关于我们', '领衔科学家']} />

            <main>
                <Row gutter={{
                    xs: 0,
                    sm: 0,
                    md: 24,
                }}>
                    <Col xs={24} sm={24} md={8} className="base-msg">
                        <div><img src={data.img}></img></div>
                        <p style={{ margin: '12px', fontSize: '18px', fontWeight: '600' }}>{data.name}</p>
                        {
                            !!data.title && <div className='base-info'><p>职称：</p>{data.title}</div>
                        }
                        {
                            !!data.contactInfo && <div className='base-info'><p>联系方式：</p>{data.contactInfo}</div>
                        }
                    </Col>
                    <Col xs={24} sm={24} md={14} className='info'>
                        <ul>
                            {
                                data.education
                                && <li>
                                        <h2>教育经历</h2>
                                        <div dangerouslySetInnerHTML={{__html:data.education}}/>
                                    </li>
                            }
                            {
                                !!data.research
                                && <li>
                                        <h2>研究简介</h2>
                                        <div dangerouslySetInnerHTML={{__html:data.research}}/>
                                    </li>
                            }
                            {
                                data.work 
                                && <li>
                                        <h2>工作经历</h2>
                                        <div dangerouslySetInnerHTML={{__html:data.work}}/>
                                    </li>
                            }
                            {
                                data.honor
                                && <li>
                                        <h2>主要荣誉</h2>
                                        <div dangerouslySetInnerHTML={{__html:data.honor}}/>
                                    </li>
                            }
                            {
                                data.achievement
                                && <li>
                                        <h2>代表性成果</h2>
                                        <div dangerouslySetInnerHTML={{__html:data.achievement}}/>
                                    </li>
                            }
                            {
                                data.intro
                                && <li>
                                    <h2>个人简介</h2>
                                    <div dangerouslySetInnerHTML={{__html:data.intro}}/>
                                </li>
                            }
                        </ul>
                    </Col>
                </Row>
            </main>
        </div>
        )
    }
}
export default withRouter(Index)